<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 2017/6/16
 * Time: 15:03
 * Project name: PHPTEST
 * File name: 2.php
 * @copyright Copyright (c) 2016 ZRX Software LLC
 * @license https://github.com/zhangrxiang
 * @since 1.0.0
 */
$bots = array(
    'Google Bot' => 'googlebot',
    'Google Bot' => 'google',
    'MSN' => 'msnbot',
    'Alex' => 'ia_archiver',
    'Lycos' => 'lycos',
    'Ask Jeeves' => 'jeeves',
    'Altavista' => 'scooter',
    'AllTheWeb' => 'fast-webcrawler',
    'Inktomi' => 'slurp@inktomi',
    'Turnitin.com' => 'turnitinbot',
    'Technorati' => 'technorati',
    'Yahoo' => 'yahoo',
    'Findexa' => 'findexa',
    'NextLinks' => 'findlinks',
    'Gais' => 'gaisbo',
    'WiseNut' => 'zyborg',
    'WhoisSource' => 'surveybot',
    'Bloglines' => 'bloglines',
    'BlogSearch' => 'blogsearch',
    'PubSub' => 'pubsub',
    'Syndic8' => 'syndic8',
    'RadioUserland' => 'userland',
    'Gigabot' => 'gigabot',
    'Become.com' => 'become.com',
    'Baidu Bot' => 'Baiduspider'
);
$should_count = true;
echo $useragent = $_SERVER['HTTP_USER_AGENT'];
foreach ($bots as $name => $lookfor) {
    if (stristr($useragent, $lookfor) !== false) {
        $should_count = false;
        break;
    }
}
if($should_count) {
    echo 'none';
}
